Skip to content

Initialize the repo for the OpenBeam application#1

Merged
duhow merged 6 commits into
mainfrom
copilot/initialize-repo-openbeam
Jul 5, 2026
Merged

Initialize the repo for the OpenBeam application#1
duhow merged 6 commits into
mainfrom
copilot/initialize-repo-openbeam

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Three UX/NFC bugs in the sharing flow:

  1. Double titleTheme.Material3.DayNight.Dialog renders its own window title slot above the dialog box, duplicating the tv_app_name inside it.
  2. NFC tap sound on non-writable tagsenableForegroundDispatch lets the OS play its default tap sound whenever any NFC tag (e.g. a payment card) is detected, even if we do nothing with it.
  3. HCE / other NFC apps not blocked — foreground dispatch doesn't pause Host Card Emulation, so the device could still respond to payment terminals while sharing.

Changes

  • ShareActivity: call supportRequestWindowFeature(Window.FEATURE_NO_TITLE) before super.onCreate() to remove the window title slot before the Dialog window is created. (supportActionBar?.hide() doesn't reach this; it only affects the AppCompat action bar layer.)

  • NfcShareHelper: replace enableForegroundDispatch / disableForegroundDispatch with enableReaderMode / disableReaderMode:

    • FLAG_READER_NO_PLATFORM_SOUNDS — suppresses the OS tap sound for all detected tags.
    • Reader mode pauses HCE while active, blocking payment terminal responses and other NFC apps.
    • Non-NDEF tags (EMV, ISO 15693, etc.) are silently dropped in the reader callback — Ndef.get(tag) and NdefFormatable.get(tag) both return null for them.
    • The reader callback runs on a background thread; pendingMessage / onResult marked @Volatile.
  • ShareActivity: SoundManager.playBeam moved from onNewIntent (now a no-op) to the NfcShareState.Writing branch — plays only when writing actually begins on a capable tag.

Original prompt

Initialize the repo for the new application OpenBeam, which is an attempt to clone "Android Beam" experience for newer Android OS versions. There is another project that implements similar, https://github.com/jzadl/openbeam , you can have a look for additional info.
Your mission is to gather information from Android Beam original functions and development code, the integrations available, and information about Quick Share functions and development code, how to integrate it. Write documents with relevant findings to keep local context available (quote the source URL or docs) and make brief summaries for the technical relevant part as we want to implement.
The app should not open by itself nor the icon should appear on the App menu, as it is a service used when "sharing through applications".
Some of the resources to share are URLs, Vcards (contact info), and images.
When sharing an image, scan the image if contains a readable QR code, and if so, interpret it and convert to NDEF compatible message (expected codes are URLs and WiFi credentials, define the class to allow supporting more types in the future).
If the image does not contain a QR, fallback to Quick Share implementation to share the file.
Avoid Google implementation as much as possible (prefer OSS alternatives without Google Services), but you may add it if required for maximum sharing compatibility and enhanced experience.
Write documents with plan and technical details and start implementation right away.
Add translations for Spanish, Catalan and English. Define a top-most UI when sharing, share once and then close/exit the app when done. Add sounds when interacting. Be brief but concise. Make as much as you can in this first iteration.

Copilot AI added 3 commits July 5, 2026 08:40
- Switch themes from Material2 (MaterialComponents) to Material3
  to fix crash: Widget.Material3.Button.TextButton requires
  Theme.Material3 parent; setContentView was throwing
  IllegalArgumentException before any UI appeared.

- Defer NFC foreground dispatch to onResume: NfcAdapter.
  enableForegroundDispatch() throws IllegalStateException when
  called before the activity is resumed. shareViaNfc() now stores
  the pending NdefMessage and onResume() enables dispatch.
  Already-resumed calls (e.g. post-QR scan) start NFC immediately
  via lifecycle.currentState.isAtLeast(RESUMED) check.

- Add runtime permission handling for Wi-Fi Direct: discoverPeers()
  requires ACCESS_FINE_LOCATION (API <33) or NEARBY_WIFI_DEVICES
  (API >=33). Show rationale in dialog, request via
  ActivityCompat.requestPermissions, resume transfer on grant.

- Add diagnostics: Log.d/e throughout (filter: adb logcat -s
  OpenBeam). On any error state show 'Copy debug info' button that
  copies device/version/NFC state and last error to clipboard.

- Add strings: status_permission_needed/denied,
  hint_permission_wifi/denied, btn_copy_debug, debug_info_copied
  across EN/ES/CA locales.
Copilot AI changed the title [WIP] Initialize the repo for the OpenBeam application fix: show share dialog UI and handle runtime permissions Jul 5, 2026
Copilot finished work on behalf of duhow July 5, 2026 09:04
Copilot AI requested a review from duhow July 5, 2026 09:04
Copilot AI changed the title fix: show share dialog UI and handle runtime permissions fix: remove double title, suppress NFC tap sound, block HCE during sharing Jul 5, 2026
Copilot finished work on behalf of duhow July 5, 2026 09:23
Copilot AI changed the title fix: remove double title, suppress NFC tap sound, block HCE during sharing fix: remove double title and suppress rogue NFC reads during sharing Jul 5, 2026
Copilot finished work on behalf of duhow July 5, 2026 09:32
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

✅ Debug APK artifact is ready for commit cba5f1e .
💾 Download APK artifact here.
Workflow run: https://github.com/duhow/openbeam/actions/runs/28736334047

@duhow duhow changed the title fix: remove double title and suppress rogue NFC reads during sharing Initialize the repo for the OpenBeam application Jul 5, 2026
@duhow duhow marked this pull request as ready for review July 5, 2026 09:39
@duhow duhow merged commit 5ab605a into main Jul 5, 2026
1 check passed
@duhow duhow deleted the copilot/initialize-repo-openbeam branch July 5, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants